<%

    String user_2 = (String) session.getAttribute("user_1");
    System.out.println(user_2 + " in");

%>

<%@page contentType="text/html" pageEncoding="UTF-8" 

        import="Ejecucion.Conection" 
        import="java.sql.*"
        %>



<head>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
    <link rel="stylesheet" href="css/a.css" type="text/css">
    <link rel="stylesheet" href="css/table.css" type="text/css">
    <title>Buscar trabajo</title>
</head>



<body>

    <article class="article0"> 
        <header>
            <center>
                <figure>
                    <br>
                    <img src="images/LogoTuJob-tn.jpg">
                </figure>

                <center class="tamanio1">
                    <div>
                        Tu oportunidad de empleo la encuentras aquí!!!!
                    </div>
                </center>         
            </center>
        </header>    

        <div class="menu1">
            <ul id="nav">
                <li class="active"> <a href="index.jsp"> Inicio </a> </li>
                <li> <a href="#"> Registro + </a>
                    <ul>
                        <li> <a href="newUser.jsp"> Registrar usuario </a> </li>
                        <li> <a href="nuevaEmpresa.jsp"> Registrar empresa </a> </li>
                    </ul>
                </li>
                <li> <a href="JobList.jsp"> Buscar empleo </a></Li>
                <li> <a href="RedSocial.jsp"> Red social </a> </li>
                    <%if (null == user_2) {
                        } else {
                            if (user_2.equals("Administrador")) {%> <li> <a href="habilitarEmpresas.jsp"> Administrar </a> </li> <%}
                            }%>
                    <%if (null == user_2) {
                        } else {
                            if (user_2.equals("Empresa")) {%> 
                <li> <a href="#"> Vacantes + </a><ul>
                        <li> <a href="newVac.jsp"> Ingresar Vacantes </a> </li>
                        <li> <a href="misVacantes.jsp"> Mis Vacantes </a> </li>
                    </ul> </li> <%}
                        }%>
                <li><a href="RedSocial.jsp"> Foro </a> </li>
                <li><a href="#"> Contáctenos </a> </li>
                <li>
                    &nbsp;&nbsp;&nbsp;
                </li>
                <li>
                    <input type="button" value="Login" onClick="window.location.href = 'LogIn.jsp'">
                </li>
                <li>
                    &nbsp;&nbsp;&nbsp;
                </li>
                <li>
                <center><input class="tamanio5" type="text" name="usuario" style="width:320px; height: 35px;" value="User/Type"></center>
                </li>
            </ul>
        </div>

        <article class="article1">
            <center>
                <table class="table1">
                    <thead>
                        <tr>
                            <th scope="col">Empresa</th>
                            <th scope="col">Usuario</th>
                            <th scope="col">URL</th>
                            <th scope="col">Correo</th>
                            <th scope="col">Telefono</th>
                            <th scope="col">Habilitado</th>
                        </tr>
                    </thead>
                    <tbody>
                        <%  Conection c = new Conection();
                            Connection con1;
                            try {
                                con1 = c.getConnection();
                                Statement stm1 = con1.createStatement();
                                ResultSet rs1;
                                String sql = "Select * from empresa order by nombre ASC;";
                                rs1 = stm1.executeQuery(sql);
                                int cont = 1;
                                while (rs1.next()) {%>
                        <tr><td><%=cont%></td><td><%= rs1.getString(3)%></td><td><%= rs1.getString(4)%></td><td><%= rs1.getString(6)%></td><td><%= rs1.getString(7)%></td><td><%= rs1.getString(8)%></td>
                            <%
                                if (rs1.getInt(9) == 0) {%>
                            <td><a href="jsp/habilitarEmpresa.jsp?id=<%= rs1.getInt(1)%>&habilitar=1"><img src="images/No.png" alt="Habilitar" Title="Habilitar"></a></td>
                                    <%} else {%>
                            <td><a href="jsp/habilitarEmpresa.jsp?id=<%= rs1.getInt(1)%>&habilitar=0"><img src="images/Ok.png" alt="Deshabilitar" Title="Deshabilitar"></a></td>
                                    <%}%>
                        </tr>
                        <%
                                    cont++;
                                }
                                con1.close();

                            } catch (SQLException ex) {
                            }%>
                    </tbody>
                </table>
            </center>
        </article>

        <aside>
            <article class="article3">
                <a href=”www.ufg.edu.sv”><img src="images/ufg.jpg" onmouseover="this.src = 'images/ufg1.jpg';" onmouseout="this.src = 'images/ufg.jpg';"></a>
                <a href=”www.ufg.edu.sv”><img src="images/chat.jpg" onmouseover="this.src = 'images/chat1.jpg';" onmouseout="this.src = 'images/chat.jpg';"></a>
                <a href=”www.ufg.edu.sv”><img src="images/Noticias.jpg" onmouseover="this.src = 'images/Noticias1.jpg';" onmouseout="this.src = 'images/Noticias.jpg';"></a>
                <a href=”www.ufg.edu.sv”><img src="images/facebook.jpg" onmouseover="this.src = 'images/facebook1.jpg';" onmouseout="this.src = 'images/facebook.jpg';"></a>
                <a href=”www.ufg.edu.sv”><img src="images/twitter.jpg" onmouseover="this.src = 'images/twitter1.jpg';" onmouseout="this.src = 'images/twitter.jpg';"></a>
            </article>
        </aside>
    </article>

</body>
